package com.mioto.ld.module.alert.model;

import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * @author mioto-qinxj
 * @date 2024/5/22
 * @desc 联动详情显示对象
 */
@Getter
@Setter
public class LinkageDetailVO extends Linkage{
    @ApiModelProperty(value = "联动触发器列表")
    private List<LinkageTrigger> linkageTriggers;

    @ApiModelProperty(value = "联动执行动作列表")
    private List<LinkageFunction> linkageFunctions;

    @ApiModelProperty(value = "是否为定时任务")
    private int isTimed;

    public int getIsTimed(){
        for (LinkageTrigger linkageTrigger : linkageTriggers) {
            if (ObjectUtil.equal(linkageTrigger.getTriggerTarget(),TriggerTargetType.TRIGGER_TARGET_TYPE_TIMED)){
                return 1;
            }
            return 0;
        }
        return 0;
    }
}
